local qibie = fk.CreateSkill {

  name = "joy__qibie",

  tags = {  },

}



qibie:addEffect(fk.Deathed, {
  name = "joy__qibie",
  anim_type = "drawcard",
  events = {fk.Deathed},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(qibie.name) and not player:isKongcheng()
  end,
  on_cost = function(self, event, target, player, data)
    local cards = player.room:askForDiscard(player,1,player:getHandcardNum(),false,qibie.name,false,".","泣别：你可以弃置任意张手牌，然后回复一点体力并摸弃置牌数+1张牌",true)
    if #cards > 0 then
      event:setCostData(self, cards)
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local n = #event:getCostData(self)
    player.room:moveCardTo(event:getCostData(self), Card.DiscardPile, player, fk.ReasonDiscard, qibie.name)
    if player.dead then return end
    if player:isWounded() then
      player.room:recover({
        who = player,
        num = 1,
        recoverBy = player,
        skillName = qibie.name
      })
    end
    if player.dead then return end
    player:drawCards(n + 1, qibie.name)
  end,
})

return qibie